﻿<%@ Page Title="" Language="C#" MasterPageFile="Site.Master" AutoEventWireup="true"
    CodeBehind="Calendar.aspx.cs" Inherits="ISS.IR.RRNMS.Web.Calendar" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <script type="text/javascript">


        window.onload = function () {
            document.getElementById('tbNewAppointmant').rows[4].style.display = "none";
            document.getElementById('tbNewAppointmant').rows[5].style.display = "none";
        };

        $(function () {
            $("#accordion").accordion({
                heightStyle: "content"
            });
        });

        function showModalPopupViaClient(ev, panelId) {
            ev.preventDefault();
            var modalPopupBehavior = $find(panelId);

            modalPopupBehavior.show();

            document.getElementById('tbNewAppointmant').rows[4].style.display = "none";
            document.getElementById('tbNewAppointmant').rows[5].style.display = "none";
        }

        function hideModalPopupViaClient(ev, panelId) {
            ev.preventDefault();
            var modalPopupBehavior = $find(panelId);
            modalPopupBehavior.hide();
        }

        function hideModalPopupViaClient_add(ev, panelId) {
            ev.preventDefault();
            var modalPopupBehavior = $find(panelId);
            modalPopupBehavior.hide();
            alert(1);
        }

        function Checked() {
            if (document.getElementById('rbnRegisteredAccount').checked) {
                document.getElementById('tbNewAppointmant').rows[4].style.display = "";
                document.getElementById('tbNewAppointmant').rows[5].style.display = "none";
                document.getElementById("programmaticModalPopupBehavior_AlreadyRegistered_foregroundElement").style.top = "190px";
            }
            else {
                document.getElementById('tbNewAppointmant').rows[5].style.display = "";
                document.getElementById('tbNewAppointmant').rows[4].style.display = "none";
                document.getElementById("programmaticModalPopupBehavior_AlreadyRegistered_foregroundElement").style.top = "100px";
            }
        }
    </script>
    <style type="text/css">
        .modalBackground
        {
            background-color: Gray;
            filter: alpha(opacity=70);
            opacity: 0.7;
        }
        
        .modalPopup
        {
            background-color: #ffffdd;
            border-width: 3px;
            border-style: solid;
            border-color: Gray;
            padding: 3px;
            width: 300px;
            vertical-align: middle;
        }
        
        .modalPopup p
        {
            padding: 5px;
        }
        .style1
        {
            width: 89%;
        }
        .style2
        {
            width: 158px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table class="style1">
        <tr>
            <td width="800">
                <asp:Label ID="lbDate" runat="server" Text=" التــــــــــــــــاريخ                                                "
                    ForeColor="White" Font-Bold="True"></asp:Label>
                <asp:TextBox ID="txtDate" runat="server" Width="246px" Height="26px" TextMode="Date"></asp:TextBox>
            </td>
            <td class="style2">
                <asp:Button ID="BtSearch" runat="server" Text="البحث" OnClick="BtSearch_Click" Font-Bold="True"
                    Font-Size="Large" Width="120px" Style="margin-right: 0px" />
            </td>
            <td>
                <asp:Button ID="btnNewDate" runat="server" Text="مقابله جديده" Font-Bold="True" Font-Size="Large"
                    Width="152px" OnClick="btnNewDate_Click" />
            </td>
        </tr>
        <tr>
            <td colspan="3" align="center">
                <asp:UpdatePanel runat="server" ID="upnlRooms">
                    <ContentTemplate>
                        <asp:Repeater ID="rptRooms" runat="server" OnItemDataBound="rptRooms_ItemDataBound">
                            <ItemTemplate>
                                <asp:Label ID="LbRooms" runat="server" Text="<%# Bind('Value') %>" ForeColor="#99CCFF"
                                    Font-Bold="True" Font-Size="Large"></asp:Label>
                                <asp:HiddenField ID="hfRoomId" runat="server" Value="<%# Bind('Id') %>"></asp:HiddenField>
                                <br />
                                <br />
                                <asp:GridView ID="gvCalenderEntries" runat="server" HorizontalAlign="Center" Font-Size="Medium"
                                    RowStyle-ForeColor="White" ForeColor="#333333" GridLines="None" HeaderStyle-ForeColor="#99CCFF"
                                    OnRowCommand="gvCalenderEntries_RowCommand" AutoGenerateColumns="false" ClientIDMode="Static">
                                    <Columns>
                                        <asp:TemplateField HeaderText="الحساب" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:HyperLink runat="server" Width="200" ID="lblAccountName" Text="<%# Bind('Account.Value') %>"
                                                    NavigateUrl='<%# Eval("Account.Guid", "Account.aspx?id={0}") %>'></asp:HyperLink>
                                                <asp:HiddenField runat="server" ID="hfAccountId" Value="<%# Bind('Account.Guid') %>">
                                                </asp:HiddenField>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="المستخدم" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:Label runat="server" Width="200" ID="lblUserName" Text="<%# Bind('User.Value') %>"></asp:Label>
                                                <asp:HiddenField runat="server" ID="hfUserId" Value="<%# Bind('User.Guid') %>"></asp:HiddenField>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Slot" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:Label runat="server" Width="150" ID="lblSlot" Text="<%# Bind('Slot') %>"></asp:Label>
                                                <asp:HiddenField runat="server" ID="hfSlotId" Value="<%# Bind('Slot.SlotId') %>">
                                                </asp:HiddenField>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                <asp:ImageButton runat="server" ID="btnDelete" HeaderStyle-Width="150" ImageUrl="images/Action-cancel-icon.png"
                                                    CommandName="DeleteAppointmant" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
                                                    OnClientClick="return confirm('هل تريد حقأ مسح البيانات');" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <EditRowStyle BackColor="#999999" />
                                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                </asp:GridView>
                            </ItemTemplate>
                            <SeparatorTemplate>
                                <hr />
                            </SeparatorTemplate>
                        </asp:Repeater>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
                    </Triggers>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button runat="server" ID="btnHiddenAlreadyRegistered" Style="display: none" />
                <ajaxToolkit:ModalPopupExtender runat="server" ID="programmaticModalPopup_AlreadyRegistered"
                    BehaviorID="programmaticModalPopupBehavior_AlreadyRegistered" TargetControlID="btnHiddenAlreadyRegistered"
                    PopupControlID="plnewappointmant" BackgroundCssClass="modalBackground" DropShadow="True"
                    PopupDragHandleControlID="programmaticPopupDragHandle_AlreadyRegistered" RepositionMode="RepositionOnWindowScroll">
                </ajaxToolkit:ModalPopupExtender>
                <asp:Panel ID="plnewappointmant" runat="server" CssClass="modalPopup" Style="display: none;
                    vertical-align: middle;" HorizontalAlign="Center" Width="300px" ClientIDMode="Static">
                    <asp:Panel runat="Server" ID="programmaticPopupDragHandle_AlreadyRegistered" Style="cursor: move;
                        background-color: #DDDDDD; border: solid 1px Gray; color: Black; text-align: center;
                        height: 30px; vertical-align: middle;">
                        <a id="A2" href="#" onclick="hideModalPopupViaClient(event,'programmaticModalPopupBehavior_AlreadyRegistered')">
                            <img src="Images/Action-cancel-icon.png" align="left" alt="إغلاق النافذة" onclick=""
                                height="30px" /></a>
                        <asp:Label ID="lblModalHeader" runat="server" Style="vertical-align: middle;" Text="مقابله جديده"
                            Font-Size="Large" Font-Bold="True"></asp:Label>
                    </asp:Panel>
                    <asp:UpdatePanel ID="uplSave" runat="server">
                        <ContentTemplate>
                            <table width="100%" align="center" id="tbNewAppointmant" runat="server" clientidmode="Static">
                                <tr>
                                    <td width="20%">
                                        <asp:Label ID="lbNDate" runat="server" Text="التــــاريخ"></asp:Label>
                                    </td>
                                    <td width="80%">
                                        <asp:TextBox ID="txtnewDate" runat="server" OnTextChanged="txtnewDate_TextChanged"
                                            AutoPostBack="true" Width="100%" ></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="20%">
                                        <asp:Label ID="lbRoom" runat="server" Text="الحجره"></asp:Label>
                                    </td>
                                    <td width="80%">
                                        <asp:DropDownList ID="ddlRoom" runat="server" Width="100%" OnSelectedIndexChanged="ddlRoom_SelectedIndexChanged"
                                            AutoPostBack="true">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="20%">
                                        <asp:Label ID="lbUser" runat="server" Text="المستخدم"></asp:Label>
                                    </td>
                                    <td width="80%">
                                        <asp:DropDownList ID="ddlUser" runat="server" Width="100%" OnSelectedIndexChanged="ddlUser_SelectedIndexChanged"
                                            AutoPostBack="true">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" align="right">
                                        <asp:RadioButton ID="rbnRegisteredAccount" runat="server" GroupName="Account" Text="لاجىء مسجل"
                                            ClientIDMode="Static" onClick="Checked()" />
                                        <asp:RadioButton ID="rbnNewAccount" runat="server" GroupName="Account" Text="لاجىء جديد"
                                            ClientIDMode="Static" onclick="Checked()" />
                                    </td>
                                </tr>
                                <tr>
                                    <td width="20%">
                                        <asp:Label ID="lbAccount" runat="server" Text="الحسـاب"></asp:Label>
                                    </td>
                                    <td width="80%">
                                        <asp:DropDownList ID="ddlAccount" Width="100%" runat="server" AutoPostBack="true">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <asp:Panel ID="pnlNewAccount" runat="server" GroupingText="لاجىء جديد" Style="padding-top: 0;
                                            padding-bottom: 0;">
                                            <table id="tblNewAacount" width="100%" cellpadding="0" cellspacing="0">
                                                <tr>
                                                    <td colspan="2">
                                                        <table width="100%" align="center">
                                                            <tr>
                                                                <td width="25%">
                                                                    الإسم الأول
                                                                </td>
                                                                <td width="25%">
                                                                    الإسم الثانى
                                                                </td>
                                                                <td width="25%">
                                                                    الإسم الثالث
                                                                </td>
                                                                <td width="25%">
                                                                    الإسم الرابع
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    <asp:TextBox ID="txtFristName" runat="server" Width="80%"></asp:TextBox>
                                                                </td>
                                                                <td>
                                                                    <asp:TextBox ID="txtSecondName" runat="server" Width="80%"></asp:TextBox>
                                                                </td>
                                                                <td>
                                                                    <asp:TextBox ID="txtThirdName" runat="server" Width="80%"></asp:TextBox>
                                                                </td>
                                                                <td>
                                                                    <asp:TextBox ID="txtFourthName" runat="server" Width="80%"></asp:TextBox>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td width="20%">
                                                        <asp:Label ID="lblUNHCR" runat="server" Text="UNHCR"></asp:Label>
                                                    </td>
                                                    <td width="80%">
                                                        <asp:TextBox ID="txtUNHCR" runat="server" Width="100%"></asp:TextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td width="20%">
                                                        <asp:Label ID="lblTele" runat="server" Text="تليفون"></asp:Label>
                                                    </td>
                                                    <td width="80%">
                                                        <asp:TextBox ID="txtTele" runat="server" Width="100%"></asp:TextBox>
                                                    </td>
                                                </tr>
                                            </table>
                                        </asp:Panel>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="20%">
                                        <asp:Label ID="lbslot" runat="server" Text="Slot"></asp:Label>
                                    </td>
                                    <td width="80%">
                                        <asp:DropDownList ID="ddlSlot" Width="100%" runat="server" AutoPostBack="true">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <asp:Label ID="lbMessage" runat="server"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" align="center">
                                        <asp:Button ID="btnSave" runat="server" Text="حفظ" Font-Bold="True" Font-Size="Medium"
                                            OnClick="btnSave_Click" />
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="btnNewDate" EventName="Click" />
                            <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
                            <asp:AsyncPostBackTrigger ControlID="ddlAccount" EventName="SelectedIndexChanged" />
                            <asp:AsyncPostBackTrigger ControlID="ddlUser" EventName="SelectedIndexChanged" />
                            <asp:AsyncPostBackTrigger ControlID="ddlRoom" EventName="SelectedIndexChanged" />
                            <asp:AsyncPostBackTrigger ControlID="ddlSlot" EventName="SelectedIndexChanged" />
                            <asp:AsyncPostBackTrigger ControlID="txtnewDate" EventName="TextChanged" />
                        </Triggers>
                    </asp:UpdatePanel>
                </asp:Panel>
            </td>
        </tr>
    </table>
</asp:Content>
